<%-- 
  - Author: Neha Chauhan
  - Date: 11-Apr-2011
  - Copyright Notice: TRAKHEES
  - Description: edit.jsp
 --%>

<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>

<script type="text/javascript">
	$()
			.ready(
					function() {

						//$("input:submit, input:reset, input:button, input:file").button();

						$("#EditRegisteredCompanyUser")
								.validate(
										{
											onfocusout : false,
											onkeyup : false,
											//onclick: false,			
											rules : {
												strCompNameEng : "required",
												strCompNameArab : "required",
												strUserName : "required",
												strEmailAddress : "required",
												strPassword : "required",
												strConfirmPassword : {
													required : true,
													equalTo : "#strPassword"
												},
												iSecQuestion : "required",
												strSecAnswer : "required",
												strMobileNumber : "required"

											},
											showErrors : function(errorMap,
													errorList) {

												var errors = '<ul>';
												var label;
												if (errorList.length) {
													$.each(errorMap, function(
															name, value) {
														label = $(
																"label[for='"
																		+ name
																		+ "']")
																.html();
														label = value + '['
																+ label + ']';
														errors = errors
																+ '<li>'
																+ label
																+ '</li>';

													});
													errors = errors + '</ul>';
													jAlert('error', errors,
															'<spring:message code="label.errormessage" />');
												}
											}

										});

					});

	$(function() {
		$("#accordion").accordion({
			accordion : false,
			speed : 500,
			closedSign : '<img src=\'/resources/images/common/close.jpg\' />',
			openedSign : '<img src=\'/resources/images/common/open.jpg\' />'
		});
		$("#accordion1").accordion({
			accordion : false,
			speed : 500,
			closedSign : '<img src=\'/resources/images/common/close.jpg\' />',
			openedSign : '<img src=\'/resources/images/common/open.jpg\' />'
		});
	});
</script>


<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>'>
	<span class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix"><spring:message code="label.menu.update.user.profile"/> </span>
	<form:form name="CompanyDetails" id="CompanyDetails" method="POST"
		modelAttribute="<%=ConstantsAdmin.USER_COMPANY_REGISTRATION_INFM_REQUEST_MODEL_KEY %>">

		<div id=accordion class="t_form">


			<fieldset>
			<legend>
			<spring:message code="label.client.summary.info" />
			</legend>
			</fieldset>

			<div class="t_form-left t_fin-black-txt">

				<div class="fm-req">
					<label> <spring:message code="label.company.nameeng" /> </label><input
						disabled="disabled"
						value='<c:out value="${clientCompanySummary.strNameENG}"></c:out>'>
				</div>
				<div class="fm-req">
					<label> <spring:message code="label.company.namearab" /> </label>
					<input
						disabled="disabled"
						value='<c:out value="${clientCompanySummary.strNameARB}"></c:out>'>
				</div>
				<div class="fm-req">
					<label> <spring:message code="label.client.trakheesID" /> </label>
					<input
						disabled="disabled"
						value='<c:out value="${clientCompanySummary.strTrakheesId}"></c:out>'>
				</div>
				
				<div class="fm-req">
					<label> <spring:message code="label.company.telnooffice" />
					</label><input disabled="disabled"
						value='<c:out value="${clientCompanySummary.strOfficeNo}"></c:out>'>
				</div>
				<div class="fm-req">
					<label> <spring:message code="label.company.role" /> </label>
					<select multiple="multiple" style="float: none;height:100px;" disabled="disabled" class="fm-opt">
						<c:forEach items="${clientCompanySummary.SCClientCompanyRoleVO}" var="clientRole" varStatus="loop">
							<c:if test="${loop.index > 0}">
								<c:out value=""></c:out>
							</c:if>
							<c:choose>
								<c:when
									test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
									<option><c:out value="${clientRole.clientRoleArb}"></c:out></option>
								</c:when>
								<c:otherwise>
									<option><c:out value="${clientRole.clientRoleEng}"></c:out></option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
				</div>

				<div class="fm-req">
					<label> <spring:message code="label.company.emailaddress" />
					</label><input disabled="disabled"
						value='<c:out value="${clientCompanySummary.strEmail}"></c:out>'>
				</div>

				<div>
					<label> <spring:message code="label.company.websiteurl" />
					</label><input disabled="disabled"
						value='<c:out value="${clientCompanySummary.strWebsite}"></c:out>'>
				</div>


				<div class="fm-req">
					<label> <spring:message code="label.company.lia" /> </label><input
						disabled="disabled"
						value='<c:out value="${clientCompanySummary.strLicenseIssuingAuth}"></c:out>'>
				</div>

				<div class="fm-req">
					<label> <spring:message code="label.company.lno" /> </label><input
						disabled="disabled"
						value='<c:out value="${clientCompanySummary.strLicenseNumber}"></c:out>'>
				</div>

				<div class="fm-req">
					<label> <spring:message code="label.company.lid" /> </label><input
						disabled="disabled"
						value='<fmt:formatDate pattern="dd-MM-yyyy"  value="${clientCompanySummary.strLicenseIssueDate}"></fmt:formatDate>'>
				</div>

				<div class="fm-req">
					<label> <spring:message code="label.company.led" /> </label><input
						disabled="disabled"
						value='<fmt:formatDate pattern="dd-MM-yyyy" value="${clientCompanySummary.strLicenseExpiryDate}"></fmt:formatDate>'>
				</div>
			</div>
		</div>

	</form:form>

	<form:form name="EditRegisteredCompanyUser"
		id="EditRegisteredCompanyUser" method="POST"
		modelAttribute="<%=ConstantsAdmin.USER_COMPANY_EDIT_INFO_REQUEST_MODEL_KEY %>">


		<spring:hasBindErrors
			name="<%=ConstantsAdmin.USER_COMPANY_EDIT_INFO_REQUEST_MODEL_KEY %>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<%
			if (request.getAttribute(ConstantsAdmin.SUCCESS_PARAM) != null) {
		%>
		<script type="text/javascript">
			$(document)
					.ready(
							function() {
								jAlert(
										'success',
										'<spring:message code="label.success.registerservice" />',
										'<spring:message code="msg.success" />');
							});
		</script>
		<%
			}
		%>

		<div id=accordion1 class="t_form">

			<fieldset>
			<legend>
			<spring:message code="label.login.details"/>
			</legend>
			</fieldset>

			<div class="t_form-left t_fin-black-txt">

				<div class="fm-req">

					<form:label path="strUserName">
						<spring:message code="label.adminname.eng" />
					</form:label>
					<form:input path="strUserName" id="strUserName" size="30"
						maxlength="100" />
				</div>


				<div class="fm-req">

					<form:label path="strUserNameArab">
						<spring:message code="label.adminname.arab" />
					</form:label>
					<form:input path="strUserNameArab" id="strUserNameArab" size="30"
						maxlength="100" />
				</div>


				<div class="fm-req">


					<form:label path="strUsrName">
						<spring:message code="label.username" />
					</form:label>
					<form:input path="strUsrName" id="strUsrName" size="30"
						maxlength="100" readonly="true" />

				</div>



				<div class="fm-req">


					<form:label path="strPassword">
					<span class="t_star">*</span>
						<spring:message code="label.password" />
					</form:label>
					<form:password path="strPassword" id="strPassword" size="30"
						maxlength="100" />

				</div>


				<div class="fm-req">


					<form:label path="strConfirmPassword">
					<span class="t_star">*</span>
						<spring:message code="label.confirmpassword" />
					</form:label>
					<form:password path="strConfirmPassword" id="strConfirmPassword"
						size="30" maxlength="100" />

				</div>

				<div class="fm-req">


					<form:label path="iSecretAnsId">
						<spring:message code="label.secretquestion" />
					</form:label>
					<c:choose>
						<c:when
							test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
							<form:select path="iSecretAnsId" items="${userSecretQuestion}"
								id="iSecretAnsId" itemLabel="labelAr" itemValue="id"
								class="fm-opt" />
						</c:when>
						<c:otherwise>
							<form:select path="iSecretAnsId" items="${userSecretQuestion}"
								id="iSecretAnsId" itemLabel="labelEn" itemValue="id"
								class="fm-opt" />
						</c:otherwise>
					</c:choose>

				</div>
				<div class="fm-req">

					<form:label path="strSecretAns">
						<spring:message code="label.anstosecretquestion" />
					</form:label>
					<form:input path="strSecretAns" id="strSecretAns" size="30"
						maxlength="100" />

				</div>
				<div class="fm-req">


					<form:label path="strEmail">
						<spring:message code="label.emailaddress" />
					</form:label>
					<form:input path="strEmail" id="strEmail" size="30" maxlength="100" />

				</div>
				<div class="fm-req">


					<form:label path="strMobile">
						<spring:message code="label.mobilenumber" />
					</form:label>
					<form:input path="strMobile" id="strMobile" size="30"
						maxlength="100" />

				</div>
				<div style="display:none;">
					<form:label path="strSmsNotification">
						<spring:message code="label.client.person.register.notifications" />
					</form:label>
					<div class="fm-multi">
						<spring:message code="label.emailnotification" />
						<form:checkbox path="strSmsNotification" value="Y"
							id="strSmsNotification" class="opt-input"/>
						<spring:message code="label.smsnotification" />
						<form:checkbox path="strEmailNotification" value="Y"
							id="strEmailNotification" class="opt-input"/>
						</div>
				</div>

			</div>

		</div>


		<div id="fm-submit" class="fm-req">
			<input
				type="submit" name="save"
				value="<spring:message code="label.button.save" />"  class="t_btns save"/>
		
			<input type="reset" name="reset"
				value="<spring:message code="label.button.reset" />" class="t_btns reset"/> 
		</div>

	</form:form>
</div>
